<div [class]="widget === false ? 'full-container' : ''">

  <div class="card-header mb-0 mb-md-4" [style]="widget ? 'display:none' : ''">
    <div class="d-flex d-md-block align-items-baseline">
      <span i18n="lightning.network-capacity">Lightning Network Capacity</span>
      <button class="btn p-0 pl-2" style="margin: 0 0 4px 0px" (click)="onSaveChart()">
        <fa-icon [icon]="['fas', 'download']" [fixedWidth]="true"></fa-icon>
      </button>
    </div>

    <form [formGroup]="radioGroupForm" class="formRadioGroup" *ngIf="(capacityObservable$ | async) as stats">
      <div class="btn-group btn-group-toggle" name="radioBasic">
        <label class="btn btn-primary btn-sm" *ngIf="stats.days >= 30" [class.active]="radioGroupForm.get('dateSpan').value === '1m'">
          <input type="radio" [value]="'1m'" fragment="1m"
            [routerLink]="['/graphs/lightning/capacity' | relativeUrl]" formControlName="dateSpan"> 1M
        </label>
        <label class="btn btn-primary btn-sm" *ngIf="stats.days >= 90" [class.active]="radioGroupForm.get('dateSpan').value === '3m'">
          <input type="radio" [value]="'3m'" fragment="3m"
            [routerLink]="['/graphs/lightning/capacity' | relativeUrl]" formControlName="dateSpan"> 3M
        </label>
        <label class="btn btn-primary btn-sm" *ngIf="stats.days >= 180" [class.active]="radioGroupForm.get('dateSpan').value === '6m'">
          <input type="radio" [value]="'6m'" fragment="6m"
            [routerLink]="['/graphs/lightning/capacity' | relativeUrl]" formControlName="dateSpan"> 6M
        </label>
        <label class="btn btn-primary btn-sm" *ngIf="stats.days >= 365" [class.active]="radioGroupForm.get('dateSpan').value === '1y'">
          <input type="radio" [value]="'1y'" fragment="1y"
            [routerLink]="['/graphs/lightning/capacity' | relativeUrl]" formControlName="dateSpan"> 1Y
        </label>
        <label class="btn btn-primary btn-sm" *ngIf="stats.days >= 730" [class.active]="radioGroupForm.get('dateSpan').value === '2y'">
          <input type="radio" [value]="'2y'" fragment="2y"
            [routerLink]="['/graphs/lightning/capacity' | relativeUrl]" formControlName="dateSpan"> 2Y
        </label>
        <label class="btn btn-primary btn-sm" *ngIf="stats.days >= 1095" [class.active]="radioGroupForm.get('dateSpan').value === '3y'">
          <input type="radio" [value]="'3y'" fragment="3y"
            [routerLink]="['/graphs/lightning/capacity' | relativeUrl]" formControlName="dateSpan"> 3Y
        </label>
        <label class="btn btn-primary btn-sm" [class.active]="radioGroupForm.get('dateSpan').value === 'all'">
          <input type="radio" [value]="'all'" fragment="all"
            [routerLink]="['/graphs/lightning/capacity' | relativeUrl]" formControlName="dateSpan"> ALL
        </label>
      </div>
    </form>
  </div>

  <div [class]="!widget ? 'chart' : 'chart-widget'" *browserOnly [style]="{ height: widget ? (height + 'px') : null}" echarts [initOpts]="chartInitOptions" [options]="chartOptions"
    (chartInit)="onChartInit($event)"></div>
  <div class="text-center loadingGraphs" *ngIf="!stateService.isBrowser || isLoading">
    <div class="spinner-border text-light"></div>
  </div>

  <div *ngIf="widget && (capacityObservable$ | async) as stats">
    <div *ngIf="stats.days === 0" class="indexing-message d-flex" i18n="lightning.indexing-in-progress">Indexing in progress</div>
  </div>

</div>